<template>
	<el-container>
		<el-aside>
		</el-aside>
		<el-container>
			<el-header>企业钉钉设置</el-header>
			<el-main>
				<el-form :model="form" :rules="rules">
					<el-form-item label="公司CorpId" label-width="150px" prop="dingdingCorpId">
						<el-input v-model="form.dingdingCorpId" placeholder="公司CorpId"></el-input>
					</el-form-item>
					<el-form-item label="微应用AgentId" label-width="150px" prop="dingdingAgentId">
						<el-input v-model="form.dingdingAgentId" placeholder="微应用AgentId"></el-input>
					</el-form-item>
					<el-form-item label="微应用AppKey" label-width="150px" prop="dingdingAppKey">
						<el-input v-model="form.dingdingAppKey" placeholder="微应用AppKey"></el-input>
					</el-form-item>
					<el-form-item label="微应用AppSecret" label-width="150px" prop="dingdingAppSecret">
						<el-input v-model="form.dingdingAppSecret" placeholder="微应用AppSecret"></el-input>
					</el-form-item>
					<div style="text-align: center">
						<el-button type="primary" @click="submit">保存</el-button>
					</div>
				</el-form>
			</el-main>
		</el-container>
		<el-aside>
		</el-aside>
	</el-container>
</template>

<script>
export default {
	name: 'Dingding Setting',
	data() {
		return {
			form:{
				dingdingCorpId:'',
				dingdingAgentId:'',
				dingdingAppKey:'',
				dingdingAppSecret:''
			},
			rules:{

			}
		}
	},
	mounted() {
		this.getDdConfig();
	},
	methods:{
		async submit()
		{
			var res = await this.$API.system.ddConfig.updateDdConfig.post(this.form)
			if(res.code == 200){
				this.$message.success(res.message);
			}else{
				this.$message.warning(res.message)
			}
		},
		async getDdConfig()
		{
			var res = await this.$API.system.ddConfig.getDdConfig.get();
			if(res.code==200)
			{
				if(res.data)
				{
					this.form = res.data;
				}
			}else {
				this.$message.warning(res.message)
			}
		}
	}
}
</script>

<style>
</style>
